<!DOCTYPE html>

<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>BFC</title>

    <style type="text/css">
        .wrapper {
            border: 1px solid blue;
            width: 400px;
            height: 100px;
            margin: auto;
        }
        
        .wrapper>div {
            width: 200px;
            height: 50px;
            background: #dedede;
            /* 谁浮动谁就是BFC */
            float: left;
        }
        
        .wrapper::before {
            width: 100px;
            height: 50px;
            background: #9696ff;
            content: '左边的';
            /* 伪元素浮动后也会产生BFC */
            float: left;
        }
        
        .wrapper::after {
            width: 100px;
            height: 50px;
            background: #9696ff;
            content: '右边的';
            float: left;
        }
    </style>
</head>

<body>

    <div class="wrapper">
        <div>中间的</div>
    </div>

</body>

</html>